import request from '@/utils/request'

export const getRoleList = (page, pagesize) => request({
  url: '/sys/role',
  params: {
    page, // 当前页
    pagesize// 每页多少条数据
  }
})

export const delRole = id => request({
  url: `/sys/role/${id}`,
  method: 'delete'
})

export const addRole = data => request({
  url: '/sys/role',
  method: 'post',
  data
})

export const getRole = id => request({
  url: `/sys/role/${id}`
})

export const editRole = data => request({
  url: `/sys/role/${data.id}`,
  method: 'put',
  data
})

// 给角色分配权限
export const editRolePermissionApi = data => request({
  url: '/sys/role/assignPrem',
  method: 'put',
  data
})
